#!/bin/bash
set -x
while true ; do
	# for each field_group (table)
	mysql -hkmxnode6 -uroot -ppassw0rd -B -e "select id from k2db.field_group;" 2>/dev/null | awk '{if (NR>1) print $0}' | while read fieldgroup; do
		# for each day
		now=$(date +%s)
		 2>/dev/null | while read line; do
			value=$(echo $line | awk '{print $1}')
			day=$(echo $line | awk '{print $2}')
			if [[ ! -z $value && ! -z $day ]]; then
				echo "put sdlg.kmx.impala.count_by_day $now $value day=$day field_group=$fieldgroup"
			fi
		done
	done
	sleep 10
done

